package com.ql.controller;

import com.ql.domain.HomeWorkSetting;
import com.ql.domain.response.JsonResult;
import com.ql.service.HomeWorkSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/homeWorkSetting")
public class HomeWorkSettingController {
    @Autowired
    HomeWorkSettingService settingService;


    @RequestMapping("/findAll.do")
    @ResponseBody
    public JsonResult findAll(String userId, @RequestParam(name = "page", required = true, defaultValue = "1") Integer page, @RequestParam(name = "limit", required = true, defaultValue = "10") Integer limit) {
        return settingService.findAll(userId, page, limit);
    }


    @RequestMapping("/save.do")
    @ResponseBody
    public JsonResult save(HomeWorkSetting homeWorkSetting, String userId) {
        return settingService.save(homeWorkSetting, userId);
    }

    @RequestMapping("/delete.do")
    @ResponseBody
    public JsonResult del(String id) {
        return settingService.del(id);
    }
}
